package io.iec.edp.caf.tenancy.api.entity;

import io.iec.caf.data.jpa.repository.CafI18nStringColumn;
import io.iec.edp.caf.data.multilang.CAFMultiLanguageColumn;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Entity
@Data
@Table(name="ecptenant")
public class EmbeddedTenant  implements Serializable {
    /**
     * 租户唯一标识
     */
    @Id
    @Column
    private int id;

    /**
     * 租户编号
     */
    @Column
    private String code;

    @Override
    public String toString() {
        return "Tenant{" +
                "id=" + id +
                ", code='" + code + '\'' +
                ", name='" + name + '\'' +
                ", createdTime=" + createdTime +
                '}';
    }

    /**
     * 租户名称
     */
    @Column
    @Embedded
    private CAFMultiLanguageColumn name;

    /**
     * 最后更新时间
     */
    @Column
    private Date createdTime;

    public EmbeddedTenant(){}

    public EmbeddedTenant(Tenant tenant){
        this.id=tenant.getId();
        this.code=tenant.getCode();
        this.createdTime=tenant.getCreatedTime();
    }
}
